package com.easy.modules.sysmgr.entity;

import java.sql.Clob;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

import com.easy.modules.common.RecordEntity;

@Entity
@Table(name = "EASY_SYSMGR_POSITION")
public class PositionEntity extends RecordEntity {

	private String name ;		//职位、岗位名称
	
	private Clob remark ;		//职位、岗位说明
	
	private Set<PositionEntity> positions = new HashSet<PositionEntity>(0);

	private PositionEntity position ;
	
	private Set<UserEntity> users = new HashSet<UserEntity>(0);
	
	@OneToMany(mappedBy = "position", fetch = FetchType.LAZY)
	@OrderBy("created desc")
	public Set<UserEntity> getUsers() {
		return users;
	}

	public void setUsers(Set<UserEntity> users) {
		this.users = users;
	}

	@OneToMany(mappedBy = "position", fetch = FetchType.LAZY)
	@OrderBy("created desc")
	public Set<PositionEntity> getPositions() {
		return positions;
	}

	public void setPositions(Set<PositionEntity> positions) {
		this.positions = positions;
	}

	@ManyToOne
	@JoinColumn(name = "POSITION_PID")
	public PositionEntity getPosition() {
		return position;
	}

	public void setPosition(PositionEntity position) {
		this.position = position;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Clob getRemark() {
		return remark;
	}

	public void setRemark(Clob remark) {
		this.remark = remark;
	}
	
	
	
}
